﻿<Page x:Class="MetroTemplate.Pages.Factures"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d"
      xmlns:vm="clr-namespace:MetroTemplate.ViewModel"
	  Title="Factures" d:DesignWidth="1645.113" d:DesignHeight="323.962">

    <Page.Resources>
        <DataTemplate x:Key="FactureListItem">
            <StackPanel>
                <TextBlock Text="{Binding Libelle}" FontSize="14.667" VerticalAlignment="Center" FontFamily="Cambria" FontWeight="Bold" Foreground="#FF0A1FEA"/>
                <TextBlock Text="{Binding DateFacture}" FontSize="15" Foreground="#FF656AA0" VerticalAlignment="Center"/>
            </StackPanel>
        </DataTemplate>
        <vm:FacturesViewModel x:Key="FactureViewModel" />
    </Page.Resources>

    <Grid DataContext="{Binding Source={StaticResource FactureViewModel} }">
        <Grid.RowDefinitions>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="250"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Border BorderThickness="1" CornerRadius="5">
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0"/>
                    <GradientStop Color="#FF9396A2" Offset="1"/>
                </LinearGradientBrush>
            </Border.BorderBrush>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="149*"/>
                    <RowDefinition Height="24"/>
                </Grid.RowDefinitions>
                <ListBox SelectionMode="Single" ItemsSource="{Binding Path=Factures}" ItemTemplate="{StaticResource FactureListItem }" SelectedItem="{Binding SelectedFacture}"/>
                <Button Content="+" Margin="0,0,0,0"  VerticalAlignment="Top" HorizontalAlignment="Right" Width="42" Grid.Row="1" Height="24"/>
                <Button Content="-" Margin="0,0,42,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="42" Grid.Row="1" Height="24"/>
            </Grid>
        </Border>
        <Grid Grid.Column="1" Grid.RowSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="157"/>
                <RowDefinition Height="167*"/>
            </Grid.RowDefinitions>
            <TextBlock HorizontalAlignment="Left" Height="26" Margin="10,10,0,0" TextWrapping="Wrap" Text="Titre :" VerticalAlignment="Top" Width="166"/>
            <TextBlock HorizontalAlignment="Left" Height="26" Margin="10,41,0,0" TextWrapping="Wrap" Text="Libelle :" VerticalAlignment="Top" Width="166"/>
            <TextBlock HorizontalAlignment="Left" Height="26" Margin="398,10,0,0" TextWrapping="Wrap" Text="Téléphone :" VerticalAlignment="Top" Width="166"/>
            <TextBlock HorizontalAlignment="Left" Height="26" Margin="398,41,0,0" TextWrapping="Wrap" Text="Date : " VerticalAlignment="Top" Width="166"/>
            <TextBlock HorizontalAlignment="Left" Height="26" Margin="10,72,0,0" TextWrapping="Wrap" Text="Informations :" VerticalAlignment="Top" Width="166"/>
            <TextBlock HorizontalAlignment="Left" Height="26" Margin="398,72,0,0" TextWrapping="Wrap" Text="Remarques" VerticalAlignment="Top" Width="166"/>
            <TextBox HorizontalAlignment="Left" Height="26" Margin="192,10,0,0" TextWrapping="Wrap" Text="{Binding SelectedFacture.Title}" Tag="{Binding SelectedFacture.FactureId}" VerticalAlignment="Top" Width="186"/>
            <TextBox HorizontalAlignment="Left" Height="26" Margin="192,41,0,0" TextWrapping="Wrap" Text="{Binding SelectedFacture.Libelle}" VerticalAlignment="Top" Width="186"/>
            <TextBox HorizontalAlignment="Left" Height="26" Margin="564,10,0,0" TextWrapping="Wrap" Text="{Binding SelectedFacture.Telephone}" VerticalAlignment="Top" Width="186"/>
            <DatePicker HorizontalAlignment="Left" Margin="564,41,0,0" VerticalAlignment="Top" Width="186" SelectedDate="{Binding SelectedFacture.DateFacture}"/>
            <RichTextBox HorizontalAlignment="Left" Height="66" Margin="192,72,0,0" VerticalAlignment="Top" Width="186">
                <FlowDocument>
                    <Paragraph>
                        <Run Text="{Binding SelectedFacture.Informations}"/>
                    </Paragraph>
                </FlowDocument>
            </RichTextBox>
            <RichTextBox HorizontalAlignment="Left" Height="66" Margin="564,73,0,0" VerticalAlignment="Top" Width="186">
                <FlowDocument>
                    <Paragraph>
                        <Run Text="{Binding SelectedFacture.Remarques}"/>
                    </Paragraph>
                </FlowDocument>
            </RichTextBox>
            <Grid Grid.Row="1">
                <DataGrid ItemsSource="{Binding Articles}" SelectedItem="{Binding SelectedArticle}"/>
            </Grid>
        </Grid>

    </Grid>
</Page>
